﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraBars;
using DAO;
using DTO;
using BUS;

namespace HOTEL_MANAGEMENT
{
    public partial class frmQuanTriHeThong : DevExpress.XtraBars.Ribbon.RibbonForm
    {

        /// 
        //int maNguoiDung = 7;
        ////
        public frmQuanTriHeThong()
        {
            InitializeComponent();
        }
        public void GoiForm(Form frm)
        {
            frm.MdiParent = this;
            frm.Dock = DockStyle.Fill;
            frm.Activate();
            frm.WindowState = FormWindowState.Normal;
            frm.Show();
        }
        public void GoiFormDangNhap(Form frm)
        {
            frm.Dock = DockStyle.Fill;
            //frm.Activate();
            frm.WindowState = FormWindowState.Minimized;
            frm.Show();
        }
        private void frmQuanTriHeThong_Load(object sender, EventArgs e)
        {
            GoiForm(SQT_TaiKhoan.getInstance().Layfrm());
            lbtenNguoiDung.Text = "Quản trị hệ thống : " + SM_DangNhap.getInstance().TenNguoiDung;
        }
        private void rbquanTriHeThong_SelectedPageChanging(object sender, DevExpress.XtraBars.Ribbon.RibbonPageChangingEventArgs e)
        {
            if (e.Page.KeyTip == "QUANTRI")
            {
                GoiForm(SQT_TaiKhoan.getInstance().Layfrm());
            }
            else if (e.Page.KeyTip == "QUIDINH")
            {
                GoiForm(SQT_QuiDinh.getInstance().Layfrm());
            }
            else if (e.Page.KeyTip == "THONGTINCANHAN")
            {
                GoiForm(STT_ThongTinCaNhan.getInstance().Layfrm());
            }
        }

        private void btndonGiaCacLoaiPhong_ItemClick(object sender, ItemClickEventArgs e)
        {
            GoiForm(SQT_thayDoiDonGiaCacLoaiPhongQTHT.getInstance().Layfrm());
        }

        private void btnheSoCacLoaiKhach_ItemClick(object sender, ItemClickEventArgs e)
        {
            GoiForm(SQT_thayDoiHeSoLoaiKhachQTHT.getInstance().Layfrm());
        }

        private void btnTiepTan_ItemClick(object sender, ItemClickEventArgs e)
        {
            SQT_TaiKhoan.getInstance().Layfrm().Hide();
            SQT_TaiKhoan.getInstance().NghiepVu = "TiepTan";
            GoiForm(SQT_TaiKhoan.getInstance().Layfrm());
        }

        private void btntatCa_ItemClick(object sender, ItemClickEventArgs e)
        {

            SQT_TaiKhoan.getInstance().Layfrm().Hide();
            SQT_TaiKhoan.getInstance().NghiepVu = "TatCa";
            GoiForm(SQT_TaiKhoan.getInstance().Layfrm());   
        }

        private void btnresetPass_ItemClick(object sender, ItemClickEventArgs e)
        {
            SQT_TaiKhoan.getInstance().Layfrm().Hide();
            SQT_TaiKhoan.getInstance().NghiepVu = "resetPass";
            GoiForm(SQT_TaiKhoan.getInstance().Layfrm()); 
        }

        private void rbquanTriHeThong_Click(object sender, EventArgs e)
        {

        }

        private void btnthongTinQuanTri_ItemClick(object sender, ItemClickEventArgs e)
        {
            SQT_TaiKhoan.getInstance().Layfrm().Hide();
            SQT_TaiKhoan.getInstance().NghiepVu = "QuanTri";
            GoiForm(SQT_TaiKhoan.getInstance().Layfrm());
           
        }

        private void btnthongTinGiamDoc_ItemClick(object sender, ItemClickEventArgs e)
        {
            SQT_TaiKhoan.getInstance().Layfrm().Hide();
            SQT_TaiKhoan.getInstance().NghiepVu = "GiamDoc";
            GoiForm(SQT_TaiKhoan.getInstance().Layfrm());
        }

    

        private void lbDangXuat_Click(object sender, EventArgs e)
        {
            if (SM_DangNhap.getInstance().LuuPass == false)
            {
                SM_DangNhap.getInstance().XoaTatCaThongTin();
            }
            SM_DangNhap.getInstance().DangNhapThanhCong = false;

            this.Close();

        }

        private void btnquiDinhKhachSan_ItemClick(object sender, ItemClickEventArgs e)
        {
            GoiForm(SQT_QuiDinh.getInstance().Layfrm());
        }

        private void frmQuanTriHeThong_FormClosing(object sender, FormClosingEventArgs e)
        {
            SM_DangNhap.getInstance().Layfrm().Visible = true;
            SM_LoadMain.getInstance().Layfrm().Visible = true;
        }

        

    }
}